'use strict'

/**
 * ctx.success      成功返回
 * ctx.fail         失败返回
 * ctx.error        异常返回
 * ctx.invalid      数据校验失败返回
 */

module.exports = {

    success(param) {
        this.body = {
            code: 200,
            result: param
        }
    },

    fail(param) {
        this.body = {
            code: 205,
            result: param
        }
    },

    error(param) {
        this.body = {
            code: 206,
            result: param
        }
        this.logger.error(this.body)
    },

    invalid(param) {
        this.body = {
            code: 204,
            result: param
        }
    }

}